package com.dragon.sdgp.util.regexpDecode.handler;

import com.dragon.sdgp.util.regexpDecode.SyntaxErrorException;

import java.util.List;

/**
 * @AUTHOR : Dragon_Yang
 * @File : PreparationHandler
 * @DESCRIPTION :
 * @DATE : 2023/3/2 16:45
 */
public class PreparationHandler extends BaseDecodeHandler{

    private PreparationHandler(){}

    @Override
    public List<MetaData> handle(String exp) {
        if(exp == null || "".equals(exp)) throw new SyntaxErrorException();
        return doNext("←" + exp + "→");
    }

    public static List<MetaData> preDecode(String exp){
        PreparationHandler preparationHandler = new PreparationHandler();
        SymbolHandler symbolHandler = new SymbolHandler();
        SplitHandler splitHandler = new SplitHandler();
        TrimHandler trimHandler = new TrimHandler();
        preparationHandler.next = symbolHandler;
        symbolHandler.next = trimHandler;
        trimHandler.next = splitHandler;
        return preparationHandler.handle(exp);
    }
}
